<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>无标题文档</title>
    <script type="text/javascript">
        var mystr = "86-010-85468578";
        document.write(mystr.split("-") + "<br />");
        document.write(mystr.split("") + "<br />");
        document.write(mystr.split("", 3) + "<br>");
        var mystr2 = "Hello World!"
        document.write(mystr2 + "<br />");

        //从字符对象mystr中提取World!子字符串
        document.write(mystr2.substring(6) + "<br />");
        //从字符对象mystr中提取Hello子字符串
        document.write(mystr2.substring(0, 5) + "<br />");

        document.write(mystr2.substr(-6) + "<br />");
        document.write(mystr2.substr(0, 5) + "<br />");
        //---------------------------------------
        document.write("---------------------------------------" + "<br />");
        //字符串分割成数组
        /*str="2,2,3,5,6,6"; //这是一字符串
        var strs= new Array(); //定义一数组
        document.write( str  + "<br />");
        strs=str.split(","); //字符分割
        for (i=0;i<strs.length ;i++ )
        {
            document.write(strs[i]+"<br/>"); //分割后的字符输出
        } */
        document.write("----------------test-----------------------" + "<br />");
        str = "2016-06-02 20:00~22:00 17"; //这是一字符串
        document.write("----------------yy-----------------------" + "<br />");
        document.write(str.substr(0, 4) + "<br />");
        document.write("----------------mm-----------------------" + "<br />");
        document.write(str.substr(5, 2) + "<br />");
        document.write("----------------day-----------------------" + "<br />");
        document.write(str.substr(8, 2) + "<br />");
        document.write("----------------start-----------------------" + "<br />");
        document.write(str.substr(11, 2) + "<br />");
        document.write("----------------end-----------------------" + "<br />");
        document.write(str.substr(17, 2) + "<br />");
        document.write("----------------member-----------------------" + "<br />");
        document.write(str.substr(23) + "<br />");


        var strs = new Array(); //定义一数组
        document.write(str + "<br />");
        strs = str.split(" "); //字符分割
        for (i = 0; i < strs.length; i++) {
            document.write(strs[i] + "<br/>"); //分割后的字符输出
        }
        document.write("xxxx\rend");
        //
        var temvar = "DEPT_ID$$部门ID";
        var index = temvar.indexOf("$$");
        console.log(index);
        console.log(temvar.substr(0, index));
        console.log(temvar.substr(index + 2));
    </script>
</head>
<body>
</body>
</html>